<?php include '../../top.html'; ?>
<?php include '../../authorization_check.php'; ?>
<?php include '../../checkStudentOnly.php'; ?>
<?php
	session_start();
	$studentID = $_SESSION['uname'];

	
	

	$username = "root";
	$password = "";
	$database = "isproje";
	$host="localhost";
	$FILE_NAME = "../../resources/data/dbparams.txt";
	if(file_exists($FILE_NAME)){
		$fp = fopen($FILE_NAME, "r" );
		$userName = trim(fgets($fp));
		$password = trim(fgets($fp));
		$database = trim(fgets($fp));
		$host = trim(fgets($fp));
		fclose($fp);
	}

	$sql = "select picture from student where studentID = ".$studentID;
	$link = mysql_connect($host, $username, $password) or die("Could not connect: " . mysql_error());
    mysql_select_db($database) or die(mysql_error());
    $result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
    
    header("Content-type: image/jpeg");
	echo mysql_result($result,0);	 
	
	mysql_close($link);
	
?>